{#**
*
* 功能描述（配置模板）
*
* @author suoya <jlusuoya@gmail.com>
* @version 1
*#}
{#include file="header.tpl" title="title" active="conf" #}
{#include file="define.tpl" scope=parent#}

<div class="content  middle">
    <div class="ui breadcrumb">
        <a class="section" href="index.php">主页</a>
        <i class="right"></i>
        <span class="active section">系统设置</span>
    </div>
    <script>
        function CheckImg()
        {
            var reg = /^.+\.jpg$/;
            var name = $("#new_img").val();
            if (!reg.test(name))
            {
                alert('请选择一个jpg图片');
                return false;
            }
            return true;
        }
    </script>
    <div class="search">
        <div class="searchTitle">
            主页展示--添加图片
        </div>
        <div class="searchBar">
            <form class="ui form" onsubmit="return CheckImg()" action="index.php?action=conf.addimg&key=index_img" method="POST" enctype="multipart/form-data" style='margin: 5px;'>
                <label>排序：</label><input size='2' name='sort' type='text' value='0' class="input_text" id="sort"/>
                <div class="ui icon input" style="display: inline; margin-top: 10px; width: 300px;">
                    <label class="date_search_label" style="display: inline-block;">图片：</label>
                    <input type="text" readonly="readonly" class="input_text">
                    <input class="input_file_upload" id='new_img' name='image' type='file' accept='image/*' onchange="changeFileInput('new_img');" style="left: 100px;" />
                </div>
                <label class="date_search_label">标签：</label><input name='title' type='text' value='' id="name" class="input_text"/>
                <label class="date_search_label">链接：</label><input name='url' type='text' value='#' id="url" class="input_text"/>
                <input type='submit' value='添加' class="button align_right"/>
                <div class="ui error message"></div>
            </form>
        </div>
    </div>
    <div class="ui raised segment">
        {#foreach $conf['index_img'] as $item#}
            <div class="search">
                <div class="searchTitle">
                    主页展示--图片{#$item['sort']#}
                </div>
                <div class="searchBar" style="padding-left: 0px; line-height: normal;">
                    <a href="{#$item['param']#}" title="{#$item['value']#}">
                        <img src="{#$web_root['web']#}/data/index_img_{#$item['id']#}.jpg" width="995" height="354"/>
                    </a>
                </div>
                <div class="searchBar">
                    <form action="index.php?action=conf.modimg&id={#$item['id']#}" method="POST" enctype="multipart/form-data" style='margin: 5px;'>
                        <label>排序：</label><input size='2' name='sort' type='text' value='{#$item['sort']#}' class="input_text"/>
                        <div class="ui icon input" style="display: inline; margin-top: 10px; width: 300px;">
                            <label class="date_search_label" style="display: inline-block;">图片：</label>
                            <input type="text" readonly="readonly" class="input_text">
                            <input class="input_file_upload" id='img{#$item@index#}' name='image' type='file' accept='image/jpg' onchange="changeFileInput('img{#$item@index#}');" style="left: 100px;" />
                        </div>
                        <label class="date_search_label">标签：</label><input name='title' type='text' value='{#$item['value']#}' class="input_text"/>
                        <label class="date_search_label">链接：</label><input name='url' type='text' value='{#$item['param']#}' class="input_text"/>
                        <input type='button' value='删除' class="button align_right" href='index.php?action=conf.delimg&id={#$item['id']#}' onclick='ajax_this(this); return false'/>
                        <input type='submit' value='修改' class="button align_right"/>
                    </form>
                </div>
            </div>
        {#/foreach#}
    </div>
</div>
    <script>
        $('.ui.form').form({
            sort: {
                identifier: 'sort',
                rules: [
                    {
                        type: 'empty',
                        prompt: '请输入排序'
                    }
                ]
            },
            title: {
                identifier: 'title',
                rules: [
                    {
                        type: 'empty',
                        prompt: '请输入标签'
                    }
                ]
            },
            url: {
                identifier: 'url',
                rules: [
                    {
                        type: 'empty',
                        prompt: '请输入链接'
                    }
                ]
            }
        });
    </script>
{#include file="footer.tpl" #}
